TemplateManager = {
	templates: {},
	get: function(id, callback) {
		var template = this.templates[id];
		if (template) {
			callback(template);
		} else {
			var that = this;
			$.ajax({
				type: 'GET',
				async: false,
				callback: callback,
		    	url: "templates/" + id + ".html",
		    	success: function (data){
			        var $tmpl = data;
			        that.templates[id] = $tmpl;
			        this.callback($tmpl);
		    	}
			});
		}
	}
}
